import { createApp } from "vue";
import App from "./App.vue";
//todo 导入animate.css
import "animate.css"; // node_modules下的插件直接写名称既可以引入

//todo 引入组件库
import {
  Button,
  Icon,
  List,
  Swipe,
  SwipeItem,
  Uploader,
  Field,
  Dialog,
  Checkbox,
  Tabbar,
  TabbarItem,
  TreeSelect,
  Grid,
  GridItem,
  Tab,
  Tabs,
  Card,
  Search,
  Lazyload,
  Popover,
  Loading,
  Overlay,
  ActionSheet,
  Cell,
  CellGroup,
  ActionBar,
  ActionBarIcon,
  ActionBarButton,
  Form,
} from "vant";
import store from "./store";

// 引入移动端自适应
import "./utils/rem"; // 直接引入就是直接调用

//todo 3 激活router
import router from "./router";
import { loadingStore } from "@/utils/request";

const app = createApp(App);
// todo  全局混入

app.mixin({
  // mixin中的内容，项目中所有组件都会继承
  // 缺点： 是全部组件都有，不管你要不要
  methods: {
    // todo fn就是n多个组件公共逻辑处理方法
    fn() {
      alert("一万行代码");
    },
  },
});

//todo 注册组件
app
  .use(Button)
  .use(Icon)
  .use(List)
  .use(Swipe)
  .use(SwipeItem)
  .use(Search)
  .use(Field)
  .use(Dialog)
  .use(Checkbox)
  .use(Tabbar)
  .use(TabbarItem)
  .use(TreeSelect)
  .use(Grid)
  .use(GridItem)
  .use(Search)
  .use(Tab)
  .use(Tabs)
  .use(Lazyload, {
    lazyComponent: true,
  })
  .use(Card)
  .use(Popover)
  .use(Loading)
  .use(Overlay)
  .use(loadingStore)
  .use(store)
  .use(Uploader)
  .use(Form)
  .use(ActionSheet)
  .use(Cell)
  .use(ActionBar)
  .use(ActionBarIcon)
  .use(ActionBarButton)
  .use(CellGroup)
  .use(Loading)
  .use(router);
app.mount("#app");
